package cn.iocoder.yudao.module.crossborder.order.dal.mysql.orderitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.orderitem.OrderItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.orderitem.vo.*;

/**
 * 跨境电商订单明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {

    default PageResult<OrderItemDO> selectPage(OrderItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderItemDO>()
                .eqIfPresent(OrderItemDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderItemDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderItemDO::getLineNo, reqVO.getLineNo())
                .eqIfPresent(OrderItemDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(OrderItemDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(OrderItemDO::getSkuCode, reqVO.getSkuCode())
                .likeIfPresent(OrderItemDO::getProductName, reqVO.getProductName())
                .eqIfPresent(OrderItemDO::getProductNameEn, reqVO.getProductNameEn())
                .eqIfPresent(OrderItemDO::getProductImage, reqVO.getProductImage())
                .likeIfPresent(OrderItemDO::getBrandName, reqVO.getBrandName())
                .likeIfPresent(OrderItemDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(OrderItemDO::getSpecValues, reqVO.getSpecValues())
                .eqIfPresent(OrderItemDO::getBarcode, reqVO.getBarcode())
                .eqIfPresent(OrderItemDO::getUpcCode, reqVO.getUpcCode())
                .eqIfPresent(OrderItemDO::getHsCode, reqVO.getHsCode())
                .eqIfPresent(OrderItemDO::getOriginCountry, reqVO.getOriginCountry())
                .eqIfPresent(OrderItemDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(OrderItemDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(OrderItemDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(OrderItemDO::getCurrencyCode, reqVO.getCurrencyCode())
                .eqIfPresent(OrderItemDO::getDiscountAmount, reqVO.getDiscountAmount())
                .eqIfPresent(OrderItemDO::getCouponAmount, reqVO.getCouponAmount())
                .eqIfPresent(OrderItemDO::getFinalPrice, reqVO.getFinalPrice())
                .eqIfPresent(OrderItemDO::getWeight, reqVO.getWeight())
                .eqIfPresent(OrderItemDO::getLength, reqVO.getLength())
                .eqIfPresent(OrderItemDO::getWidth, reqVO.getWidth())
                .eqIfPresent(OrderItemDO::getHeight, reqVO.getHeight())
                .eqIfPresent(OrderItemDO::getVolume, reqVO.getVolume())
                .eqIfPresent(OrderItemDO::getCostPrice, reqVO.getCostPrice())
                .eqIfPresent(OrderItemDO::getProfitAmount, reqVO.getProfitAmount())
                .eqIfPresent(OrderItemDO::getProfitRate, reqVO.getProfitRate())
                .eqIfPresent(OrderItemDO::getTaxRate, reqVO.getTaxRate())
                .eqIfPresent(OrderItemDO::getTaxAmount, reqVO.getTaxAmount())
                .eqIfPresent(OrderItemDO::getWarrantyPeriod, reqVO.getWarrantyPeriod())
                .eqIfPresent(OrderItemDO::getIsGift, reqVO.getIsGift())
                .eqIfPresent(OrderItemDO::getGiftMessage, reqVO.getGiftMessage())
                .eqIfPresent(OrderItemDO::getIsCustomized, reqVO.getIsCustomized())
                .eqIfPresent(OrderItemDO::getCustomizationInfo, reqVO.getCustomizationInfo())
                .eqIfPresent(OrderItemDO::getDeliveryDeadline, reqVO.getDeliveryDeadline())
                .betweenIfPresent(OrderItemDO::getExpectedDeliveryDate, reqVO.getExpectedDeliveryDate())
                .eqIfPresent(OrderItemDO::getFulfillmentStatus, reqVO.getFulfillmentStatus())
                .eqIfPresent(OrderItemDO::getAllocatedWarehouseId, reqVO.getAllocatedWarehouseId())
                .eqIfPresent(OrderItemDO::getAllocatedQuantity, reqVO.getAllocatedQuantity())
                .eqIfPresent(OrderItemDO::getPickedQuantity, reqVO.getPickedQuantity())
                .eqIfPresent(OrderItemDO::getShippedQuantity, reqVO.getShippedQuantity())
                .eqIfPresent(OrderItemDO::getDeliveredQuantity, reqVO.getDeliveredQuantity())
                .eqIfPresent(OrderItemDO::getReturnedQuantity, reqVO.getReturnedQuantity())
                .eqIfPresent(OrderItemDO::getRefundedQuantity, reqVO.getRefundedQuantity())
                .eqIfPresent(OrderItemDO::getCancelReason, reqVO.getCancelReason())
                .eqIfPresent(OrderItemDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderItemDO::getId));
    }

}